The present invention relates generally to cache memory for a computer processor, and more specifically, to a prefetch threshold for cache restoration in a computer processor.
In a computer system, in order to implement parallel execution of various software applications, the operating system (OS) may allot fixed units of time for execution of each thread, or task, referred to as the task's time quantum. A task is allowed to run uninterrupted for its given time quantum before the OS switches to another task, unless an event occurs that prevents the task from completing its time quantum (e.g., the task needs to wait on an input/output (I/O) operation). When a task resumes execution in a subsequent time quantum, entries belonging to that task may no longer be available in the cache, incurring a time penalty. This penalty may be particularly pronounced after, for example, a virtual machine swap from a first partition of the computing system to a second partition. Virtual machine swaps may occur at a level of magnitude longer in latency than task swaps under an OS. As such, after a virtual machine swap, the last time the given program of interest under the OS was run is likely to be further away from the core (further out in memory), and hence the pronounced penalty. The addresses of at least a subset of the cache lines belonging to a task that is not currently executing may be recorded at the time that they are evicted from the cache for prefetching when the task is rescheduled and resumes execution in a subsequent time quantum.